package models

import (
	"fmt"
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

var DB *gorm.DB
var err error

func UserMysqlLink() {
	DB, err = gorm.Open(mysql.Open("root:89B158B4DAFE6F5461878D26EA49B100@tcp(14.103.158.217:3306)/5.24work?charset=utf8&parseTime=True&loc=Local"))
	if err != nil {
		panic(err)
	}
	if DB.AutoMigrate(&User{}) != nil {
		panic("迁移表失败")
	}
	fmt.Println("mysql link open")
}
